<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/student_info.min.css">
</head>

<body>
    <div class="wrap">
        <h2>学生信息输入</h2>
        <table class="student_info" border="1px">
            <tr>
                <th>学号（必填）</th>
                <th>姓名（必填）</th>
                <th>性别（必填）</th>
                <th>籍贯（必填）</th>
                <th>出生日期</th>
                <th>爱好</th>
                <th>男或女朋友</th>
                <th>头像</th>
            </tr>
            <tr>
                <td contenteditable="true" class="stu_id"></td>
                <td contenteditable="true" class="stu_name"></td>
                <td contenteditable="true" class="stu_sex"></td>
                <td contenteditable="true" class="stu_jg"></td>
                <td contenteditable="true" class="stu_date"></td>
                <td contenteditable="true" class="stu_hobby"></td>
                <td contenteditable="true" class="stu_gbf"></td>
                <td contenteditable="true" class="stu_head_img"></td>
            </tr>
            <tr>
                <td colspan="7"></td>
                <td><button class="stu_info_sub">提交</button></td>
            </tr>
        </table>
    </div>
    <div class="wrap">
        <h2>学生入学考试成绩</h2>
        <table class="student_info" border="1px">
            <tr>
                <th>学号（必填）</th>
                <th>姓名（必填）</th>
                <th>语文（必填）</th>
                <th>数学（必填）</th>
                <th>英语（必填）</th>
                <th>理综（必填）</th>
                <th>文综（必填）</th>
            </tr>
            <tr>
                <td contenteditable="true" class="stu_id"></td>
                <td contenteditable="true" class="stu_name"></td>
                <td contenteditable="true" class="chinese"></td>
                <td contenteditable="true" class="math"></td>
                <td contenteditable="true" class="english"></td>
                <td contenteditable="true" class="lizong"></td>
                <td contenteditable="true" class="wenzong"></td>
            </tr>
            <tr>
                <td colspan="6"></td>
                <td><button class="stu_entry_exam">提交</button></td>
            </tr>
        </table>
    </div>
    <div class="wrap">
        <h2>学生期中考试成绩</h2>
        <table class="student_info" border="1px">
            <tr>
                <th>学号（必填）</th>
                <th>姓名（必填）</th>
                <th>语文（必填）</th>
                <th>数学（必填）</th>
                <th>英语（必填）</th>
                <th>理综（必填）</th>
                <th>文综（必填）</th>
            </tr>
            <tr>
                <td contenteditable="true" class="stu_id"></td>
                <td contenteditable="true" class="stu_name"></td>
                <td contenteditable="true" class="chinese"></td>
                <td contenteditable="true" class="math"></td>
                <td contenteditable="true" class="english"></td>
                <td contenteditable="true" class="lizong"></td>
                <td contenteditable="true" class="wenzong"></td>
            </tr>
            <tr>
                <td colspan="6"></td>
                <td><button class="stu_mid_exam">提交</button></td>
            </tr>
        </table>
    </div>
    <div class="wrap">
        <h2>学生期末考试成绩</h2>
        <table class="student_info" border="1px">
            <tr>
                <th>学号（必填）</th>
                <th>姓名（必填）</th>
                <th>语文（必填）</th>
                <th>数学（必填）</th>
                <th>英语（必填）</th>
                <th>理综（必填）</th>
                <th>文综（必填）</th>
            </tr>
            <tr>
                <td contenteditable="true" class="stu_id"></td>
                <td contenteditable="true" class="stu_name"></td>
                <td contenteditable="true" class="chinese"></td>
                <td contenteditable="true" class="math"></td>
                <td contenteditable="true" class="english"></td>
                <td contenteditable="true" class="lizong"></td>
                <td contenteditable="true" class="wenzong"></td>
            </tr>
            <tr>
                <td colspan="6"></td>
                <td><button class="stu_end_exam">提交</button></td>
            </tr>
        </table>
    </div>
</body>
<script src="./jquery/jquery-3.2.1.min.js"></script>
<script>
    //学生信息输入
    $(".stu_info_sub").click(() => {
        $.ajax({
            method: "post",
            url: "http://localhost:3000/set_student_info",
            data: {
                stu_id: $(".stu_id").text(),
                stu_name: $(".stu_name").text(),
                stu_sex: $(".stu_sex").text(),
                stu_jg: $(".stu_jg").text(),
                stu_date: $(".stu_date").text(),
                stu_hobby: $(".stu_hobby").text(),
                stu_gbf: $(".stu_gbf").text(),
                stu_head_img: $(".stu_head_img").text(),
            },
            success: (data) => {
                console.log(data)
            },
            error: (err) => {
                console.log(err)
            }
        })
    })
    //学生入学成绩输入
    $(".stu_entry_exam").click(() => {
        $.ajax({
            method: "post",
            url: "http://localhost:3000/entre_exam",
            data: {
                stu_id: $(".stu_id").text(),
                stu_name: $(".stu_name").text(),
                chinese: $(".chinese").text(),
                math: $(".math").text(),
                english: $(".english").text(),
                lizong: $(".lizong").text(),
                wenzong: $(".wenzong").text(),
            },
            success: (data) => {
                console.log(data)
            },
            error: (err) => {
                console.log(err)
            }
        })
    })
    //学生期中成绩输入
    $(".stu_mid_exam").click(() => {
        $.ajax({
            method: "post",
            url: "http://localhost:3000/mid_exam",
            data: {
                stu_id: $(".stu_id").text(),
                stu_name: $(".stu_name").text(),
                chinese: $(".chinese").text(),
                math: $(".math").text(),
                english: $(".english").text(),
                lizong: $(".lizong").text(),
                wenzong: $(".wenzong").text(),
            },
            success: (data) => {
                console.log(data)
            },
            error: (err) => {
                console.log(err)
            }
        })
    })
    //学生期末成绩输入
    $(".stu_end_exam").click(() => {
        $.ajax({
            method: "post",
            url: "http://localhost:3000/end_exam",
            data: {
                stu_id: $(".stu_id").text(),
                stu_name: $(".stu_name").text(),
                chinese: $(".chinese").text(),
                math: $(".math").text(),
                english: $(".english").text(),
                lizong: $(".lizong").text(),
                wenzong: $(".wenzong").text(),
            },
            success: (data) => {
                console.log(data)
            },
            error: (err) => {
                console.log(err)
            }
        })
    })
</script>

</html>